package com.tuo51.evaluate.repositories.appusers;

import com.tuo51.evaluate.domain.appusers.PayWxOrder;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface PayWxOrderRepository extends JpaRepository<PayWxOrder, Long>, JpaSpecificationExecutor<PayWxOrder> {

    @Query(value = "select * from pay_wx_order where order_no = ?1" ,nativeQuery = true)
    PayWxOrder findOneByOrderNo(String orderNo);


    Page<PayWxOrder> findAllByOrderByCreateTimeDesc(Pageable pageable);
    Page<PayWxOrder> findAllByPromoCodeIdOrderByCreateTimeDesc(String promoCodeId, Pageable pageable);
}
